import { ref, computed, reactive } from "vue";
import { defineStore } from "pinia";
import _ from "lodash";

export const useFormStore = defineStore("form", () => {
  const datas = ref([
    { key: '', value:{} },
  ]);

  const Add = (key,data) => {
    if (!_.some(datas.value, { key: key })) {
        datas.value.push({ key: key, data: data});
    }
  };

  const Set = (key) => {
    datas.value = _.reject(datas.value, { key: key });
  };
  return { datas, Add,Set };
});
